import time
from curl_cffi import requests


def get_captcha():
    data = {
        "key": "314eff12b79693c48331a82feefcdc12",
        "method": "tencent",
        "app_id": "2052282982",
        "pageurl": "https://www.qizhidao.com/secure/manmachine?redirectUrl=https%3A%2F%2Fzhengce.qizhidao.com%2Fpublicity%2Fcamp%2F89f411ea341289eb7f1ba7d924091c1a.html",
        "json": 1
    }

    resp = requests.post('https://2captcha.com/in.php', data=data).json()
    print(resp)
    time.sleep(20)
    response = requests.post('https://2captcha.com/res.php', data={
        'key': '314eff12b79693c48331a82feefcdc12',
        "action": "get",
        "id": resp['request'],
        "json": 1,
    })
    print(response.text)

    return response.json()

if __name__ == '__main__':
    get_captcha()